/*******************************************************************************
 * Copyright 2011 Alexandre Zglav and Morphiastic
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.morphiastic.analysis.analyzers;

import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;

import com.morphiastic.analysis.AnalysisComponentDefinition;



/**
 * A special analyzer that is only a reference to another existing analyzer definition
 * @author Alex
 *
 */
public class ReferenceAnalyzer extends ElasticAnalyzer{

	 
	/**
	 * 
	 * @param elasticAnalyzerType
	 * @param defName is used as the name of the analyzer we are pointing to
	 */
	public ReferenceAnalyzer(ElasticAnalyzerType elasticAnalyzerType, String defName) {
		super(elasticAnalyzerType, defName);
	}

	
	@Override
	public boolean hasCustomParams() {
		return false;
	}


	@Override
	public XContentBuilder addToBuilder(XContentBuilder mappingBuilder) {
		return mappingBuilder;
	}


	@Override
	public void setParamsFromSettings(Settings analyzerSettings) {
		// nothing to do
	}


	@Override
	public boolean areEquivalentDefinitions(AnalysisComponentDefinition otherAnalyzer) {
		return otherAnalyzer instanceof ReferenceAnalyzer;
	}

}
